from django.utils.deprecation import MiddlewareMixin

from user.models import *


class MD(MiddlewareMixin):
    def process_request(self, request):
        uid = request.GET.get('uid', None)
        if uid:
            # user = User_Identity.objects.filter(user_id=uid)
            # request.level = user.identity.level
            request.level = int(uid) & 1

from django.utils.deprecation import MiddlewareMixin

from user.models import *


class MD(MiddlewareMixin):
    def process_request(self, request):
        uid = request.GET.get('uid', None)
        if uid:
            # user = User_Identity.objects.filter(user_id=uid)
            # request.level = user.identity.level
            request.level = int(uid) & 1

def QingJiaInfoSer(id):
    i = QinjiaMoban.objects.get(id=id)

    zt = {0: '未审批', 1: '已通过', 2: '未通过', 3: '审批中'}
    user_info = User.objects.get(id=i.uid)

    js = {}
    js['id'] = i.id
    js['username'] = user_info.username
    js['start'] = zt[i.start]
    js['info'] = eval(i.info)
    js['refuse'] = i.refuse

    return js